fix: use positional args for wrap_function_wrapper() in genai instrumentations#4445
Merged
fix: use positional args for wrap_function_wrapper() in genai instrumentations#4445
Conversation
…entations Change wrap_function_wrapper() calls from keyword arguments to positional arguments in anthropic, openai-v2, langchain, and vertexai instrumentations. This fixes a TypeError in environments with wrapt versions that don't accept the `module` keyword argument. Also update requirements.latest.txt for anthropic, openai-v2, and vertexai to test with wrapt==2.1.2, keeping requirements.oldest.txt at wrapt==1.16.0. Assisted-by: Claude Opus 4.6 Agent-Logs-Url: https://github.com/open-telemetry/opentelemetry-python-contrib/sessions/ced2c291-67d2-4b1c-a529-27a19eb20770 Co-authored-by: lmolkova <2347409+lmolkova@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix wrap_function_wrapper() issues in genai instrumentations
fix: use positional args for wrap_function_wrapper() in genai instrumentations
Apr 16, 2026
Member
|
@copilot are you going to fix tests? you need to resolve conflicts in test dependencies (latest) to make fresh wrapt work. Also add changelog entry for each affected library. keep it short |
- Bump Deprecated to 1.3.1 in openai-v2 and vertexai requirements.latest.txt to resolve conflict with wrapt==2.1.2 (Deprecated<1.3.0 requires wrapt<2) - Add changelog entries for all 4 affected packages (anthropic, openai-v2, langchain, vertexai) Assisted-by: Claude Opus 4.6 Agent-Logs-Url: https://github.com/open-telemetry/opentelemetry-python-contrib/sessions/1b66cb2e-9b29-4111-a5e1-cede00b74efb Co-authored-by: lmolkova <2347409+lmolkova@users.noreply.github.com>
Contributor
Author
Done in fb8b47d:
|
lmolkova
approved these changes
Apr 16, 2026
xrmx
approved these changes
Apr 17, 2026
Nik-Reddy
pushed a commit
to Nik-Reddy/opentelemetry-python-contrib
that referenced
this pull request
May 5, 2026
Nik-Reddy
added a commit
to Nik-Reddy/opentelemetry-python-contrib
that referenced
this pull request
May 5, 2026
4 tasks
Nik-Reddy
added a commit
to Nik-Reddy/opentelemetry-python-contrib
that referenced
this pull request
May 6, 2026
Nik-Reddy
added a commit
to Nik-Reddy/opentelemetry-python-contrib
that referenced
this pull request
May 9, 2026
Nik-Reddy
added a commit
to Nik-Reddy/opentelemetry-python-contrib
that referenced
this pull request
May 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
wrap_function_wrapper()was called with keyword arguments (module=,name=,wrapper=) in several genai instrumentations. Certain wrapt versions (including 2.x) do not acceptmoduleas a keyword argument, causing auto-instrumentation to fail withTypeError: wrap_function_wrapper() got an unexpected keyword argument 'module'.Changes
Source fixes — switch from keyword to positional args in all affected
_instrument()methods:opentelemetry-instrumentation-anthropicopentelemetry-instrumentation-openai-v2opentelemetry-instrumentation-langchainopentelemetry-instrumentation-vertexaiTest matrix — update
requirements.latest.txtfor anthropic, openai-v2, and vertexai to pinwrapt==2.1.2, reproducing the failure scenario;requirements.oldest.txtremains atwrapt==1.16.0. Also bumpDeprecatedto1.3.1inrequirements.latest.txtfor openai-v2 and vertexai, sinceDeprecated < 1.3.0requireswrapt < 2and conflicts withwrapt==2.1.2.Changelogs updated for all 4 affected packages.
Type of change
How Has This Been Tested?
requirements.latest.txtupdated towrapt==2.1.2for affected packages — the new version would have triggered theTypeErrorbefore this fixDeprecatedbumped to1.3.1in latest requirements to resolve the transitive conflict with wrapt 2.x (Deprecated < 1.3.0pinswrapt < 2)requirements.oldest.txtleft unchanged atwrapt==1.16.0to continue validating the legacy pathDoes This PR Require a Core Repo Change?
Checklist: